<?php
$catid = (int) $_GET['catid'];
$id = (int) $_GET['id'];
$p_url = go($catid,$id);
?>
{template "member","header"}
<script type="text/javascript" src="{JS_PATH2}jquery.reveal.js"></script>
<script type="text/javascript" src="{JS_PATH2}userinfo.gaojian1.js"></script>
<style type="text/css">
a.pcon{display:block;}
.personalCenterList li:first-child {
    height:.42rem;
}

</style>

<!-- header -->
<header class="header bg2 clearfix" {$catid}>
	<h3 class="fl"><a href="{get_ref($p_url)}" title="返回上一级"><img src="{IMG_PATH2}icon/back.png" alt="返回上一级"></a></h3>
	<span class="con">我要当导师</span>
</header>
<!-- / header -->
<div class="h_48"></div>

<!-- main -->
<main class="main">
	<div class="h_10"></div>
	<ul class="personalCenterList">

	<form action="" enctype="multipart/form-data" method="post"  onsubmit="return:false;">
		<li class="pcon">
			<div class="name11 fl">姓名</div>
			<input readonly  id="name" class="con10 fr" data-reveal="modal-main" data-name="realname" value="{$info[realname]}">
		</li>
		<li class="pcon">
			<div class="name11 fl">联系方式</div>
			<input readonly class="con10 fr" id="tel" data-reveal="modal-main" data-name="mobile" value="{$info[mobile]}">
		</li>
		<li class="pcon">
			<div class="name11 fl">行业</div>
			<input readonly class="con10 fr" id="trade" data-reveal="modal-main" data-name="field" value="{$info[field]}">
		</li>
		<li class="pcon">
			<div class="name11 fl">职务</div>
			<input readonly class="con10 fr" id="job" data-reveal="modal-main" data-name="job" value="{$info[job]}">
		</li>
		<div class="h_10"></div>
		<div class="p_name11 fl">我擅长</div>
		<li class="pcon1">			
			<textarea rows="2"  id="goodjob" onfocus="if(value=='例如：我擅长帮离婚夫妻解决财务纠纷'){value=''}"
			    onblur="if (value ==''){value='例如：我擅长帮离婚夫妻解决财务纠纷'}">例如：我擅长帮离婚夫妻解决财务纠纷</textarea>
			<div class="detail_yuejian_num"><strong id="wordCheck">0</strong>/300</div>
		</li>
		<div class="h_10"></div>
		<div class="my_ziliao">可接受的预约方式 <em>*</em></div>
		<div class="yuyueway bgwhite clearfix">
			<a href="javascript:;">电话约谈</a>
			<a href="javascript:;" class="cur">导师约见</a>
			<a href="javascript:;">任务委托</a>
		</div>
		<div class="h_75"></div>
		<div class="btn_dui"><a href="javascript:void(0);" class="js_duihuan" data-reveal-id="myModal1" data-animation="fade">提 交</a></div>
	</form>
	</ul>
</main>
<!-- / main -->

<!--信息资料修改-->
<div class="reveal-modal big" id="modal-main">
	<h1>@</h1>
	<input type="text" class="textEdit" id="modal-main-input">
	<div class="clearfix">
		<a class="close-reveal-modal fl">取 消</a>
		<input type="submit" class="btnSubmitSave1 fr" value="确 定" id="modal-main-submit">
	</div>
</div>
<!-- /信息资料修改-->
<script type="text/javascript">
$("#goodjob").keyup(function(){
	
         var length = 300;
         var content_len = $("#goodjob").val().length;
         var in_len = length-content_len;
        
         if(in_len >0){
            $("#wordCheck").html(content_len);
            $("#goodjob").attr("disabled",false);            
         }else{
            $("#wordCheck").html(content_len);
            $("#goodjob").attr("disabled",true);
            return false;
         }        
    });
	$(function(){
		$(".yuyueway a").click(function(){
			$(this).toggleClass("cur");
		});

		$("#wordCheck").html($("#goodjob").val().length);
	})
	$("#goodjob").click(function(){
		var content_len = $("#goodjob").val().length;
		$("#wordCheck").html(content_len);
	})
	$("#goodjob").blur(function(){
		var content_len = $("#goodjob").val().length;
		$("#wordCheck").html(content_len);
	})
	$('.js_duihuan').click(function(){
		var name=$('#name').val();
		var tel=$('#tel').val();
		var trade=$('#trade').val();
		var job=$('#job').val();
		var goodjob=$('#goodjob').val();
		var type='';
		$(".yuyueway .cur").each(function(){
		    type+=$(this).index();
		    type+=",";
		});

		$.post('?m=member&c=apply&a=do_teacher',{realname:name,mobile:tel,trade:trade,job:job,goodjob:goodjob,type:type},function(data){	
				alert_msg(data,function() {
					location.hash = 'commit';
					location.reload();
					if (data=='您已经成功提交了申请，之后会有工作人员给您电话沟通，请保持电话畅通') {
						window.location.href='?m=member';
					};
				},3000);
			
		});
	//选择
	$('input[data-reveal=modal-main]').live('click', function(e) {
		e.preventDefault();
		var _text = $(this).siblings('div').text();
		var _name = $(this).data('name');
		var _val = $(this).val();

		$('#modal-main h1').text(_text);
		$('#modal-main-input').data('name', _name);
		$('#modal-main-input').val(_val);

		$('#modal-main').reveal();
	});

	//提交
	$('#modal-main-submit').click(function() {
		var _name = $('#modal-main-input').data('name');
		var _val = $('#modal-main-input').val();

		$.ajax({
			type: 'post',
			url: '/index.php?m=member&c=edit&a=part',
			data: {
				'name': _name,
				'val': _val
			},
			dataType: 'json',
			success: function(res) {
				console.log(res);
				if (res.status == 100) {
					$('input[data-name=' + _name + ']').val(_val);
					$('.close-reveal-modal').trigger('click');

					if (res.data == 'all') {
						alert_jifen(res.desc, 200);
					}
				} else {
					alert_msg(res.desc);
				}
			}
		});
	});
		
	})
</script>
{template "content","footer"}